#pragma once

namespace Common
{
namespace System
{
namespace Threading
{

template<class TLock>
class CScopeLockT
{
public:
	CScopeLockT(TLock & CS) : m_pLock(&CS)
	{

		CS.Lock();
	}
	~CScopeLockT()
	{
		m_pLock->Unlock();
	}
private:
   TLock * m_pLock;
};

typedef CScopeLockT<CComAutoCriticalSection> CComScopeAutoLock;

}//namespace Threading
}//namespace System
}//namespace Common